package com.atguigu07.encapsulation.exer3;

import java.util.Scanner;

/**
 * ClassName: EmployeeTest
 * Package: com.atguigu07.encapsulation.exer3
 * Description:
 *
 * @Author xiao_qi
 * @Create 2024/5/8 18:20
 * @Version 1.0
 */
public class EmployeeTest {
    public static void main(String[] args){
      Scanner scan = new Scanner(System.in);

      Employee[] emp = new Employee[2];

        for (int i = 0; i < emp.length; i++) {

            emp[i] = new Employee();

            System.out.println("----------添加第" + (i + 1) + "个员工----------");
            System.out.print("姓名：");
            String name = scan.next();
            System.out.print("性别：");
            String gender = scan.next();
            System.out.print("年龄：");
            int age = scan.nextInt();
            System.out.print("电话：");
            String number = scan.next();

            emp[i].setName(name);
            emp[i].setGender(gender);
            emp[i].setAge(age);
            emp[i].setNumber(number);}


            System.out.println("---------------员工列表------------------");
            System.out.println("编号\t姓名\t性别\t年龄\t电话");
            for (int j = 0; j < emp.length; j++) {
                System.out.println((j+1)+"\t"+emp[j].getinfo());
            }
            System.out.println("---------------员工列表完成------------------");




    }
}
